<?php
/**
 * File: Cache.php:YCMS
 * User: xiaoyan f@yanyunfeng.com
 * Date: 15-5-4
 * Time: 下午3:42
 * @Description
 */
class Cache{

    private static $cache = null;
    private $cacheList = array();

    private function Cache(){}
    public static function getInstance()
    {
        if (self::$cache != null) {
            return self::$cache;
        }
        self::$cache = new Cache();
        return self::$cache;
    }

    public function exists($key){
        return isset($this->cacheList[$key]);
    }
    public function set($key,$data){
        $this->cacheList[$key]= $data;
    }
    public function get($key){
        return $this->exists($key) ? $this->cacheList[$key] : null;
    }
}